package com.lzx.mq.feign;

import com.lzx.mq.result.R;
import com.lzx.mq.vo.Articles;
import com.lzx.mq.vo.QueryUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

@Component
@FeignClient("five-cube-es")
public interface ESClient {

    //用户修改头像或昵称，批量更新数据(问题)
    @PutMapping("/es/web/problem/updateUserNicknameOrAvatar")
    R updateUserNicknameOrAvatar(@RequestBody QueryUser queryUser);

    //用户修改头像或昵称，批量更新数据(文章
    @PutMapping("/es/web/article/updateNicknameOrAvatar")
    R updateNicknameOrAvatar(@RequestBody QueryUser queryUser);

    //添加文章
    @PostMapping("/es/web/addArticle/{articleId}")
    R addArticle(@PathVariable Long articleId);

    //修改文章(es数据同步)
    @PutMapping("/es/web/editArticle/{articleId}")
    R editArticle(@PathVariable Long articleId);

    //将数据重新导入es
    @PostMapping("/es/web/saveProblemList")
    R saveProblemList();

    //修改文章
    @PutMapping("/es/web/editArticle")
    R editArticle(@RequestBody Articles articles);
}
